﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace XNAGuiLib.Core.Utilities
{
    public class ColorBlend
    {
        /// <summary>
        /// modulates the color's alpha value for opaque
        /// </summary>
        /// <param name="color">base color to modulate</param>
        /// <param name="alpha">alpha value to use</param>
        /// <returns>new color with modulated alpha value</returns>
        public static Color ModulateAlpha(Color color, byte alpha)
        {
            return new Color(color.R, color.G, color.B, alpha);
        }

        /// <summary>
        /// modulates the color's red value
        /// </summary>
        /// <param name="color">base color to modulate</param>
        /// <param name="red">red value to use</param>
        /// <returns>new color with modulated red value</returns>
        public static Color ModulateRed(Color color, byte red)
        {
            return new Color(red, color.G, color.B, color.A);
        }

        /// <summary>
        /// modulates the color's green value
        /// </summary>
        /// <param name="color">base color to modulate</param>
        /// <param name="green">green value to use</param>
        /// <returns>new color with modulated green value</returns>
        public static Color ModulateGreen(Color color, byte green)
        {
            return new Color(color.R, green, color.B, color.A);
        }

        /// <summary>
        /// modulates the color's blue value
        /// </summary>
        /// <param name="color">base color to modulate</param>
        /// <param name="blue">blue value to use</param>
        /// <returns>new color with modulated blue value</returns>
        public static Color ModulateBlue(Color color, byte blue)
        {
            return new Color(color.R, color.G, blue, color.A);
        }

        /// <summary>
        /// modulates the color's red, green and blue values
        /// </summary>
        /// <param name="color">base color to modulate</param>
        /// <param name="red">red value to use</param>
        /// <param name="green">green value to use</param>
        /// <param name="blue">blue value to use</param>
        /// <returns>new color with modulated red, green and blue values</returns>
        public static Color ModulateRGB(Color color, byte red, byte green, byte blue)
        {
            return new Color(red, green, blue, color.A);
        }

        /// <summary>
        /// creates a color from the given red, green and blue values
        /// </summary>
        /// <param name="red">red value to use</param>
        /// <param name="green">green value to use</param>
        /// <param name="blue">blue value to use</param>
        /// <returns>new color with the given values</returns>
        public static Color RGB(byte red, byte green, byte blue)
        {
            return new Color(red, green, blue);
        }

        /// <summary>
        /// creates a color from the given red, green and blue values
        /// </summary>
        /// <param name="red">red value to use</param>
        /// <param name="green">green value to use</param>
        /// <param name="blue">blue value to use</param>
        /// <param name="alpha">alpha value to use</param>
        /// <returns>new color with the given values</returns>
        public static Color RGBA(byte red, byte green, byte blue, byte alpha)
        {
            return new Color(red, green, blue, alpha);
        }

    }
}
